import Pageable = Api.Common.Pageable;
import Page = Api.Common.Page;
import {request} from "@/service/request";

export function fetchDeleteRowByOrder(params: any) {
  return request<Api.Entity.OrderMember>({
    url: '/order/deleteRow',
    method: 'post',
    data: params
  });
}

export function fetchGetMemberByOrder(params: any) {
  return request<Api.Entity.OrderMember>({
    url: '/order-member/getByOrderId',
    method: 'post',
    data: params
  });
}

export function fetchGetUsers() {
  return request<Api.Entity.User[]>({
    url: '/order/getUsers',
    method: 'post',
    data: {}
  });
}

export function fetchGetCurrentTemplates() {
  return request<Api.Entity.Template[]>({
    url: '/order/getCurrentTemplates',
    method: 'post',
    data: {}
  });
}

/** 订单分页查询 */
export function fetchGetOrderPage(params?: Pageable) {
  return request<Page<Api.Entity.Order>>({
    url: '/order/page',
    method: 'post',
    data: params
  });
}

export function fetchSaveOrder(params: Api.Entity.Order) {
  return request<Api.Entity.Order>({
    url: '/order/save',
    method: 'post',
    data: params
  });
}

export function fetchDeleteOrder(ids: number[]) {
  return request<Api.Entity.Order>({
    url: '/order/delete',
    method: 'post',
    data: {
      ids: ids
    }
  });
}

export function fetchUpdateOrder(params: Api.Entity.Order) {
  return request<Api.Entity.Order>({
    url: '/order/update',
    method: 'post',
    data: params
  });
}


export function fetchGetOrder(params: any) {
  return request<Api.Entity.Order>({
    url: '/order/getOne',
    method: 'post',
    data: params
  });
}
